package main

import (
	"fmt"
	"os"
	"io"
	"bufio"
)

func main() {
	var rd io.Reader
	if len(os.Args)>1 {
		filenames:=os.Args[1:]
		files:=make([]io.Reader,0,len(filenames))
		for _, fname := range filenames {
			pf,openErr:=os.Open(fname)
			if openErr != nil {
				fmt.Fprintln(os.Stderr, "Cannot read file", fname)
				continue
			}
			files=append(files,pf)
		}
		rd=io.MultiReader(files...)
	} else {
		rd=os.Stdin
	}

	reader:=bufio.NewReader(rd)
	for {
		line,err:=reader.ReadString('\n')
		fmt.Print(line)
		if(err != nil) {break}
	}
}
